<%+cbi/valueheader%>
<script type="text/javascript">//<![CDATA[
    function flush_cache(btn, dataname)
    {
        btn.disabled = true;
        btn.value = '<%:Flushing...%> ';
        st=dataname;
        XHR.get('<%=luci.dispatcher.build_url("admin", "services", "mosdns", "flush_cache")%>',
            { set:st },
            function(x,data)
            {
            var tb = document.getElementById(dataname+'-status');
            if (tb)
            {
                switch (data.flushing)
                {
                    case true:
                        tb.innerHTML = "<font color='green'>" + "<%:Flushing Success%>" + "</font>";
                        break;
                    case false:
                        tb.innerHTML = "<font color='red'>" + "<%:Flushing Failed, Please check if MosDNS is enabled%>" + "</font>";
                        break;
                }
            }
                btn.disabled = false;
                btn.value    = '<%:Flush Cache%>';
            }
        );
        return false;
    }
//]]></script>
<input type="button" class="btn cbi-button-action" value="<%:Flush Cache%>" onclick="return flush_cache(this,'<%=self.option%>')" />
<span id="<%=self.option%>-status"><em><%=self.value%></em></span>
<%+cbi/valuefooter%>
